const express = require('express');
const router = express.Router();
const messageController = require('../controllers/message.controller');
const { authenticate } = require('../middleware/auth');

// 所有消息路由都需要认证
router.use(authenticate);

// 消息操作路由
router.post('/', messageController.sendMessage);
router.get('/received', messageController.getReceivedMessages);
router.get('/sent', messageController.getSentMessages);
router.put('/:id/read', messageController.markAsRead);
router.delete('/:id', messageController.deleteMessage);
router.get('/unread-count', messageController.getUnreadCount);

module.exports = router;